package com.dfrz;

import com.dfrz.entity.Goods;
import com.dfrz.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {

    public static void main(String[] args) {
        //去classpath中找到文件
        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring01.xml");
        //根据类型获取 bean(对象)
        User user = ctx.getBean(User.class);
        System.out.println(user);

        //根据ID获取
        Goods goods = ctx.getBean("goods", Goods.class);
        System.out.println(goods);
    }

}
